import React, {PureComponent} from 'react';
import './index.less'

import {Form, Icon, Button, Input, Select, DatePicker, Radio, TreeSelect, message, Upload, Modal, Checkbox} from 'antd';
import Fetch from '../../../../../fetchAPI';
import tools from '../../../../../utils/tools'
import moment from "../step1";

const {TextArea} = Input;
const SHOW_PARENT = TreeSelect.SHOW_PARENT;
const CheckboxGroup = Checkbox.Group;
const RadioGroup = Radio.Group;
const {RangePicker} = DatePicker;
const Option = Select.Option;


const oterProps = [
    {label: '普通商品', value: 2},
    {label: '新品', value: 0},
    {label: '金牌优先购', value: 3},
    {label: '今日上新', value: 4},
    {label: '本周上新', value: 5},
    {label: '最新降价', value: 6},
];


class Step2 extends PureComponent {
    constructor(props) {
        super(props)
    }

    state = {
        loading: false,
        err: false,
        ERPtreeData: [],
        commoditytreeData: [],
        brandList: [],
        colorList: [],
        virtualList: [],
        commodityValue: [],
        excelFileList: [],
        isCommodityType: true,
        isERPType: true,
        rangeCount: 0
    };

    componentDidMount = () => {
        Promise.all([
            this.getAllType(),
            this.getAllBrand(),
            this.getAllColor(),
            this.getVirtualArea(),
            this.getAllERPType()
        ])/*.then(() => {
            const {pid} = this.props.location.query;
            if (pid) {
                this.getRangeCondition(pid)
            }
        });*/
        this.setState({
            isCommodityType: true,
            isERPType: false
        })

    }

    next = () => {

        this.props.toView(2)
    }
    reset = () => {
        this.setState({
            promotionIcon: [],
            presellBackground: [],
        });
        this.props.form.resetFields();
    }
    onChange = (value) => {

    }

    brandSearch = (value) => {
        value = value.replace(/^\s*|^\s$/, '');
        console.log(value.length);
        if (value[0] === ">" && value.length > 1) {
            this.setState({
                brandList: this.brandList.map((item) => {
                    return {
                        value: item.key,
                        name: item.vaule,

                    }
                }).filter((item) => {
                    return (item.name && item.name[0].toUpperCase() === value[1].toUpperCase());
                })
            })
        } else if (value !== '' && (value.length > 2)) {
            let reg=new RegExp(value,'i');
            this.setState({
                brandList: this.brandList.map((item) => {
                    return {
                        value: item.key,
                        name: item.vaule,
                    }
                }).filter((item) => {
                    return (item.name && item.name.search(reg) !== -1);
                })
            })
        }

    }

    downLoad = () => {
        window.location.href = require('../../../../../localData/WarehouseProductNos.xls');
    }
     // getRangeCondition = (id) => {
     //     Fetch.getRangeCondition({id}).then(res => {
     //         if (res.result) {
     //             const {setFieldsValue} = this.props.form;
     //             const {
     //                 brandNo,
     //                 categoryNo,
     //                 colorNo,
     //                 newSeason,
     //                 priceMax,
     //                 priceMin,
     //                 rangeType,
     //                 categorySelectType,
     //                 erpCategoryNo,
     //                 virtualAreaNo
     //             } = res.result;
     //
     //             if (brandNo) {
     //                 let brands = brandNo.split(',').map((item1) => {
     //                     return this.brandList.map((item) => {
     //                         return {
     //                             value: item.key,
     //                             name: item.vaule
     //                         }
     //                     }).filter((item) => {
     //                         return (item.value === item1);
     //                     })[0]
     //                 });
     //                 if (brands[0]) {
     //                     this.setState({
     //                         brandList: brands
     //                     });
     //                     setTimeout(() => {
     //                         setFieldsValue({
     //                             select_brand: brandNo && brandNo.split(','),
     //                         });
     //                     }, 10);
     //                 }
     //             }
     //             if (categorySelectType === 0) {
     //                 this.setState({
     //                     isCommodityType: false,
     //                     isERPType: true
     //                 })
     //             } else {
     //                 this.setState({
     //                     isCommodityType: true,
     //                     isERPType: false
     //                 })
     //             }
     //
     //             setFieldsValue({
     //                 otherProps: newSeason,
     //                 range: rangeType,
     //                 selectType: Number(categorySelectType),
     //                 commodityType: categoryNo && categoryNo.split(','),
     //                 ERPType: erpCategoryNo && erpCategoryNo.split(','),
     //                 virtualDistrict: virtualAreaNo && virtualAreaNo.split(','),
     //                 minPrice: priceMin + '',
     //                 maxPrice: priceMax + '',
     //                 selectColor:colorNo===''?[]: colorNo && colorNo[0] && colorNo.split(',')
     //             });
     //         }
     //
     //     })
     //
     // }
    getAllType = () => {
        return Fetch.getAllType().then(() => {
            const res={
                "isSuccess": true,
                "code": "200",
                "message": null,
                "rowCount": 0,
                "result": [{"key": "A05", "vaule": "二手", "text": "ROOT"}, {
                    "key": "A04",
                    "vaule": "美妆",
                    "text": "ROOT"
                }, {"key": "A02", "vaule": "男士", "text": "ROOT"}, {"key": "A03", "vaule": "礼品卡", "text": "ROOT"}, {
                    "key": "A01",
                    "vaule": "女士",
                    "text": "ROOT"
                }, {"key": "A02B03C52D22", "vaule": "兔兔鞋", "text": "A02B03C52"}, {
                    "key": "A01B15",
                    "vaule": "11",
                    "text": "A01"
                }, {"key": "A01B14", "vaule": "美妆", "text": "A01"}, {
                    "key": "A02B03C52D21",
                    "vaule": "帆布鞋",
                    "text": "A02B03C52"
                }, {"key": "A02B03C52D20", "vaule": "帆船鞋", "text": "A02B03C52"}, {
                    "key": "A01B13",
                    "vaule": "腕表1",
                    "text": "A01"
                }, {"key": "A01B12", "vaule": "123", "text": "A01"}, {
                    "key": "A02B03C52D19",
                    "vaule": "豆豆鞋",
                    "text": "A02B03C52"
                }, {"key": "A02B03C52D18", "vaule": "便鞋", "text": "A02B03C52"}, {
                    "key": "A01B10",
                    "vaule": "测试0705",
                    "text": "A01"
                }, {"key": "A01B11", "vaule": "1", "text": "A01"}, {
                    "key": "A02B02C63D07",
                    "vaule": "长袖T恤",
                    "text": "A02B02C63"
                }, {"key": "A02B03C52D01", "vaule": "休闲皮鞋", "text": "A02B03C52"}, {
                    "key": "A01B02C89D01",
                    "vaule": "T恤1123456",
                    "text": "A01B02C89"
                }, {"key": "A01B02C89D11", "vaule": "条纹T", "text": "A01B02C89"}, {
                    "key": "A03B01C02D09",
                    "vaule": "祝福卡",
                    "text": "A03B01C02"
                }, {"key": "A02B02C63D11", "vaule": "羽绒服", "text": "A02B02C63"}, {
                    "key": "A02B02C63D03",
                    "vaule": "长袖衬衫",
                    "text": "A02B02C63"
                }, {"key": "A03B01C02D08", "vaule": "节日卡", "text": "A03B01C02"}, {
                    "key": "A01B02C89D12",
                    "vaule": "字母数字T1234",
                    "text": "A01B02C89"
                }, {"key": "A01B02", "vaule": "女装0705", "text": "A01"}, {
                    "key": "A03B01C02D07",
                    "vaule": "婚礼卡",
                    "text": "A03B01C02"
                }, {"key": "A01B03", "vaule": "女鞋0705", "text": "A01"}, {
                    "key": "A03B01C02D06",
                    "vaule": "春节卡",
                    "text": "A03B01C02"
                }, {"key": "A02B02C63D04", "vaule": "针织衫/毛衣", "text": "A02B02C63"}, {
                    "key": "A02B02C63D06",
                    "vaule": "卫衣",
                    "text": "A02B02C63"
                }, {"key": "A03B01C02D05", "vaule": "感谢卡", "text": "A03B01C02"}, {
                    "key": "A02B06",
                    "vaule": "腕表1",
                    "text": "A02"
                }, {"key": "A01B04", "vaule": "配饰0705", "text": "A01"}, {
                    "key": "A01B02C89D02",
                    "vaule": "衬衫",
                    "text": "A01B02C89"
                }, {"key": "A01B01C60D01", "vaule": "手提包", "text": "A01B01C60"}, {
                    "key": "A01B01C60D15",
                    "vaule": "杀手包",
                    "text": "A01B01C60"
                }, {"key": "A01B02C90D11", "vaule": "喇叭裤", "text": "A01B02C90"}, {
                    "key": "A01B03C62D08",
                    "vaule": "滑板鞋",
                    "text": "A01B03C62"
                }, {"key": "A01B05", "vaule": "家居0705", "text": "A01"}, {
                    "key": "A03B01C02D04",
                    "vaule": "商务卡",
                    "text": "A03B01C02"
                }, {"key": "A02B03C52D02", "vaule": "休闲运动鞋", "text": "A02B03C52"}, {
                    "key": "A02B02C63D09",
                    "vaule": "长袖Polo衫",
                    "text": "A02B02C63"
                }, {"key": "A02B02", "vaule": "男装0705", "text": "A02"}, {
                    "key": "A02B03C55D14",
                    "vaule": "洞洞鞋",
                    "text": "A02B03C55"
                }, {"key": "A03B01C02D03", "vaule": "生日卡", "text": "A03B01C02"}, {
                    "key": "A05B03",
                    "vaule": "二手箱包",
                    "text": "A05"
                }, {"key": "A02B05", "vaule": "箱包", "text": "A02"}, {
                    "key": "A03B01C03",
                    "vaule": "礼品卡类型",
                    "text": "A03B01"
                }, {"key": "A02B03C56D01", "vaule": "商务正装鞋", "text": "A02B03C56"}, {
                    "key": "A01B07",
                    "vaule": "美妆0705",
                    "text": "A01"
                }, {"key": "A01B03C62D07", "vaule": "篮球鞋", "text": "A01B03C62"}, {
                    "key": "A01B02C94D10",
                    "vaule": "运动裤",
                    "text": "A01B02C94"
                }, {"key": "A01B02C91D06", "vaule": "雪纺裙", "text": "A01B02C91"}, {
                    "key": "A01B02C90D01",
                    "vaule": "牛仔裤",
                    "text": "A01B02C90"
                }, {"key": "A01B01C60D02", "vaule": "单肩包", "text": "A01B01C60"}, {
                    "key": "A01B01",
                    "vaule": "箱包0705",
                    "text": "A01"
                }, {"key": "A01B01C60D17", "vaule": "饺子包", "text": "A01B01C60"}, {
                    "key": "A01B02C94D09",
                    "vaule": "运动配件",
                    "text": "A01B02C94"
                }, {"key": "A01B02C96D03", "vaule": "牛仔夹克", "text": "A01B02C96"}, {
                    "key": "A01B03C62D06",
                    "vaule": "运动鞋",
                    "text": "A01B03C62"
                }, {"key": "A01B05C39D03", "vaule": "zbj家居003", "text": "A01B05C39"}, {
                    "key": "A05B02",
                    "vaule": "二手腕表",
                    "text": "A05"
                }, {"key": "A02B05C03", "vaule": "钱包", "text": "A02B05"}, {
                    "key": "A03B01C02",
                    "vaule": "场景分类",
                    "text": "A03B01"
                }, {"key": "A03B01C01D02", "vaule": "电子礼品卡", "text": "A03B01C01"}, {
                    "key": "A03B01C03D02",
                    "vaule": "电子礼品卡",
                    "text": "A03B01C03"
                }, {"key": "A03B01C02D02", "vaule": "情人卡", "text": "A03B01C02"}, {
                    "key": "A02B03C53D01",
                    "vaule": "及踝靴",
                    "text": "A02B03C53"
                }, {"key": "A01B10C03", "vaule": "测试123", "text": "A01B10"}, {
                    "key": "A02B03",
                    "vaule": "男鞋0705",
                    "text": "A02"
                }, {"key": "A02B02C70", "vaule": "男士运动裤", "text": "A02B02"}, {
                    "key": "A02B02C68D07",
                    "vaule": "运动裤",
                    "text": "A02B02C68"
                }, {"key": "A01B10C02", "vaule": "测试3级", "text": "A01B10"}, {
                    "key": "A01B10C03D01",
                    "vaule": "测试商城分类",
                    "text": "A01B10C03"
                }, {"key": "A01B11C02", "vaule": "11", "text": "A01B11"}, {
                    "key": "A02B02C63D01",
                    "vaule": "短袖T恤",
                    "text": "A02B02C63"
                }, {"key": "A02B03C52", "vaule": "日常休闲鞋", "text": "A02B03"}, {
                    "key": "A02B03C53D02",
                    "vaule": "及膝靴",
                    "text": "A02B03C53"
                }, {"key": "A03B01C02D01", "vaule": "标准卡", "text": "A03B01C02"}, {
                    "key": "A03B01C03D01",
                    "vaule": "实物礼品卡",
                    "text": "A03B01C03"
                }, {"key": "A05B03C02", "vaule": "男包", "text": "A05B03"}, {
                    "key": "A05B03C01D02",
                    "vaule": "女包",
                    "text": "A05B03C01"
                }, {"key": "A03B01C01D01", "vaule": "实物礼品卡", "text": "A03B01C01"}, {
                    "key": "A03B01C01",
                    "vaule": "畅销礼品卡",
                    "text": "A03B01"
                }, {"key": "A03B01", "vaule": "礼品卡0705", "text": "A03"}, {
                    "key": "A02B05C02",
                    "vaule": "公文包",
                    "text": "A02B05"
                }, {"key": "A02B03C56D02", "vaule": "商务休闲鞋", "text": "A02B03C56"}, {
                    "key": "A01B05C39D02",
                    "vaule": "zbj家居002",
                    "text": "A01B05C39"
                }, {"key": "A01B03C62D05", "vaule": "训练鞋", "text": "A01B03C62"}, {
                    "key": "A01B04C54D01",
                    "vaule": "男表",
                    "text": "A01B04C54"
                }, {"key": "A01B04C52D09", "vaule": "珠宝", "text": "A01B04C52"}, {
                    "key": "A01B02C96D02",
                    "vaule": "牛仔裙",
                    "text": "A01B02C96"
                }, {"key": "A01B02C97", "vaule": "123", "text": "A01B02"}, {
                    "key": "A01B02C94D08",
                    "vaule": "运动T恤",
                    "text": "A01B02C94"
                }, {"key": "A01B02C90D02", "vaule": "休闲裤", "text": "A01B02C90"}, {
                    "key": "A01B02C89D05",
                    "vaule": "POLO衫",
                    "text": "A01B02C89"
                }, {"key": "A01B02C91D03", "vaule": "印花裙", "text": "A01B02C91"}, {
                    "key": "A01B02C92D01",
                    "vaule": "西装",
                    "text": "A01B02C92"
                }, {"key": "A01B02C94D01", "vaule": "运动POLO", "text": "A01B02C94"}, {
                    "key": "A01B02C97D01",
                    "vaule": "321",
                    "text": "A01B02C97"
                }, {"key": "A01B02C96D01", "vaule": "牛仔裤", "text": "A01B02C96"}, {
                    "key": "A01B02C96",
                    "vaule": "牛仔",
                    "text": "A01B02"
                }, {"key": "A01B02C95D05", "vaule": "头巾", "text": "A01B02C95"}, {
                    "key": "A01B04C52D08",
                    "vaule": "珍珠项链",
                    "text": "A01B04C52"
                }, {"key": "A01B04C54D02", "vaule": "女表", "text": "A01B04C54"}, {
                    "key": "A01B04C53D01",
                    "vaule": "太阳镜",
                    "text": "A01B04C53"
                }, {"key": "A01B03C63", "vaule": "尖头鞋", "text": "A01B03"}, {
                    "key": "A01B05C39D01",
                    "vaule": "家居001",
                    "text": "A01B05C39"
                }, {"key": "A01B05C39", "vaule": "家居01", "text": "A01B05"}, {
                    "key": "A05B03C02D01",
                    "vaule": "男包",
                    "text": "A05B03C02"
                }, {"key": "A02B03C56D03", "vaule": "婚礼/宴会鞋", "text": "A02B03C56"}, {
                    "key": "A02B05C01",
                    "vaule": "手提包",
                    "text": "A02B05"
                }, {"key": "A05B03C01", "vaule": "女包", "text": "A05B03"}, {
                    "key": "A05B02C01D01",
                    "vaule": "自动机械",
                    "text": "A05B02C01"
                }, {"key": "A05B02C01", "vaule": "瑞士手表", "text": "A05B02"}, {
                    "key": "A02B03C53",
                    "vaule": "靴子",
                    "text": "A02B03"
                }, {"key": "A02B03C55D04", "vaule": "篮球鞋", "text": "A02B03C55"}, {
                    "key": "A02B03C54D03",
                    "vaule": "厚底鞋",
                    "text": "A02B03C54"
                }, {"key": "A02B02C63", "vaule": "上装", "text": "A02B02"}, {
                    "key": "A02B02C63D02",
                    "vaule": "POLO衫",
                    "text": "A02B02C63"
                }, {"key": "A01B11C01", "vaule": "测试", "text": "A01B11"}, {
                    "key": "A01B10C03D02",
                    "vaule": "测试展示分类",
                    "text": "A01B10C03"
                }, {"key": "A01B10C01D01", "vaule": "测试三004", "text": "A01B10C01"}, {
                    "key": "A01B10C01",
                    "vaule": "测试二003",
                    "text": "A01B10"
                }, {"key": "A01B07C27D05", "vaule": "cs", "text": "A01B07C27"}, {
                    "key": "A02B02C68D06",
                    "vaule": "运动短裤",
                    "text": "A02B02C68"
                }, {"key": "A02B02C64D05", "vaule": "泳裤", "text": "A02B02C64"}, {
                    "key": "A02B02C65D02",
                    "vaule": "风衣",
                    "text": "A02B02C65"
                }, {"key": "A02B02C67D01", "vaule": "西装套装", "text": "A02B02C67"}, {
                    "key": "A02B02C66D01",
                    "vaule": "内裤",
                    "text": "A02B02C66"
                }, {"key": "A02B02C68D01", "vaule": "运动T恤", "text": "A02B02C68"}, {
                    "key": "A02B03C51D01",
                    "vaule": "凉鞋",
                    "text": "A02B03C51"
                }, {"key": "A02B02C69D01", "vaule": "帽子", "text": "A02B02C69"}, {
                    "key": "A02B02C65",
                    "vaule": "外套",
                    "text": "A02B02"
                }, {"key": "A02B02C64D01", "vaule": "牛仔裤", "text": "A02B02C64"}, {
                    "key": "A02B03C55D01",
                    "vaule": "休闲鞋",
                    "text": "A02B03C55"
                }, {"key": "A02B03C54D01", "vaule": "增高鞋", "text": "A02B03C54"}, {
                    "key": "A02B03C56",
                    "vaule": "商务皮鞋",
                    "text": "A02B03"
                }, {"key": "A01B05C38D01", "vaule": "抱枕", "text": "A01B05C38"}, {
                    "key": "A01B07C25D01",
                    "vaule": "洁面",
                    "text": "A01B07C25"
                }, {"key": "A01B07C25", "vaule": "护肤", "text": "A01B07"}, {
                    "key": "A01B07C27D01",
                    "vaule": "女士香水",
                    "text": "A01B07C27"
                }, {"key": "A01B07C26D01", "vaule": "卸妆", "text": "A01B07C26"}, {
                    "key": "A01B04C55D01",
                    "vaule": "办公用品",
                    "text": "A01B04C55"
                }, {"key": "A01B05C32D01", "vaule": "水壶水杯", "text": "A01B05C32"}, {
                    "key": "A01B05C31D01",
                    "vaule": "床品套装",
                    "text": "A01B05C31"
                }, {"key": "A01B05C31", "vaule": "床上用品", "text": "A01B05"}, {
                    "key": "A01B05C37D01",
                    "vaule": "毛巾浴巾",
                    "text": "A01B05C37"
                }, {"key": "A01B05C36D01", "vaule": "耳机音箱", "text": "A01B05C36"}, {
                    "key": "A01B05C35D01",
                    "vaule": "锅具",
                    "text": "A01B05C35"
                }, {"key": "A01B05C34D01", "vaule": "生活日用", "text": "A01B05C34"}, {
                    "key": "A01B05C33D01",
                    "vaule": "工艺摆件",
                    "text": "A01B05C33"
                }, {"key": "A01B03C62D01", "vaule": "休闲鞋", "text": "A01B03C62"}, {
                    "key": "A01B03C61D01",
                    "vaule": "拖鞋",
                    "text": "A01B03C61"
                }, {"key": "A01B04C53D02", "vaule": "光学镜架", "text": "A01B04C53"}, {
                    "key": "A01B04C52D01",
                    "vaule": "项链",
                    "text": "A01B04C52"
                }, {"key": "A01B04C52", "vaule": "珠宝", "text": "A01B04"}, {
                    "key": "A01B02C94D07",
                    "vaule": "运动卫衣",
                    "text": "A01B02C94"
                }, {"key": "A01B02C95D01", "vaule": "帽子", "text": "A01B02C95"}, {
                    "key": "A01B03C60D01",
                    "vaule": "及踝靴",
                    "text": "A01B03C60"
                }, {"key": "A01B03C59D01", "vaule": "平底鞋", "text": "A01B03C59"}, {
                    "key": "A01B03C59",
                    "vaule": "单鞋",
                    "text": "A01B03"
                }, {"key": "A01B03C58D01", "vaule": "平底凉鞋", "text": "A01B03C58"}, {
                    "key": "A01B02C93D01",
                    "vaule": "文胸",
                    "text": "A01B02C93"
                }, {"key": "A01B02C92D09", "vaule": "小西装", "text": "A01B02C92"}, {
                    "key": "A01B02C92",
                    "vaule": "外套1",
                    "text": "A01B02"
                }, {"key": "A01B02C91D01", "vaule": "连衣裙", "text": "A01B02C91"}, {
                    "key": "A01B01C64D01",
                    "vaule": "拉杆箱",
                    "text": "A01B01C64"
                }, {"key": "A01B01C63D01", "vaule": "运动单肩包", "text": "A01B01C63"}, {
                    "key": "A01B01C62D01",
                    "vaule": "钥匙包",
                    "text": "A01B01C62"
                }, {"key": "A01B01C60D16", "vaule": "水桶包", "text": "A01B01C60"}, {
                    "key": "A01B01C61D01",
                    "vaule": "手提包",
                    "text": "A01B01C61"
                }, {"key": "A01B01C60", "vaule": "女包", "text": "A01B01"}, {
                    "key": "A01B01C60D03",
                    "vaule": "钱包001",
                    "text": "A01B01C60"
                }, {"key": "A01B01C61", "vaule": "男包", "text": "A01B01"}, {
                    "key": "A01B01C61D02",
                    "vaule": "公文包",
                    "text": "A01B01C61"
                }, {"key": "A01B01C63D02", "vaule": "运动双肩包", "text": "A01B01C63"}, {
                    "key": "A01B01C62D02",
                    "vaule": "票据夹",
                    "text": "A01B01C62"
                }, {"key": "A01B01C64D02", "vaule": "旅行袋", "text": "A01B01C64"}, {
                    "key": "A01B02C89",
                    "vaule": "上装1",
                    "text": "A01B02"
                }, {"key": "A01B02C89D17", "vaule": "印花卫衣", "text": "A01B02C89"}, {
                    "key": "A01B02C91D02",
                    "vaule": "半身裙",
                    "text": "A01B02C91"
                }, {"key": "A01B02C92D02", "vaule": "风衣", "text": "A01B02C92"}, {
                    "key": "A01B02C93D02",
                    "vaule": "内裤",
                    "text": "A01B02C93"
                }, {"key": "A01B02C94D02", "vaule": "运动外套", "text": "A01B02C94"}, {
                    "key": "A01B03C59D02",
                    "vaule": "中低跟鞋",
                    "text": "A01B03C59"
                }, {"key": "A01B03C60", "vaule": "靴子", "text": "A01B03"}, {
                    "key": "A01B03C60D02",
                    "vaule": "中筒靴",
                    "text": "A01B03C60"
                }, {"key": "A01B02C95D02", "vaule": "腰带", "text": "A01B02C95"}, {
                    "key": "A01B03C58D02",
                    "vaule": "中低跟凉鞋",
                    "text": "A01B03C58"
                }, {"key": "A01B04C53D03", "vaule": "运动眼镜", "text": "A01B04C53"}, {
                    "key": "A01B04C53",
                    "vaule": "眼镜",
                    "text": "A01B04"
                }, {"key": "A01B03C61D02", "vaule": "保暖家居鞋", "text": "A01B03C61"}, {
                    "key": "A01B04C52D02",
                    "vaule": "手链",
                    "text": "A01B04C52"
                }, {"key": "A01B03C62D02", "vaule": "跑步鞋", "text": "A01B03C62"}, {
                    "key": "A01B05C33D02",
                    "vaule": "花瓶花器",
                    "text": "A01B05C33"
                }, {"key": "A01B05C35D02", "vaule": "刀具配件", "text": "A01B05C35"}, {
                    "key": "A01B05C34D02",
                    "vaule": "收纳用品",
                    "text": "A01B05C34"
                }, {"key": "A01B05C37D02", "vaule": "卫浴用品", "text": "A01B05C37"}, {
                    "key": "A01B05C36D02",
                    "vaule": "生活小家电",
                    "text": "A01B05C36"
                }, {"key": "A01B05C32", "vaule": "餐具水具", "text": "A01B05"}, {
                    "key": "A01B05C32D02",
                    "vaule": "餐具",
                    "text": "A01B05C32"
                }, {"key": "A01B04C55D02", "vaule": "数码配件", "text": "A01B04C55"}, {
                    "key": "A01B05C31D02",
                    "vaule": "被子/床垫",
                    "text": "A01B05C31"
                }, {"key": "A01B07C26", "vaule": "彩妆", "text": "A01B07"}, {
                    "key": "A01B07C26D02",
                    "vaule": "防晒",
                    "text": "A01B07C26"
                }, {"key": "A01B07C25D02", "vaule": "化妆水", "text": "A01B07C25"}, {
                    "key": "A01B05C38D02",
                    "vaule": "桌布",
                    "text": "A01B05C38"
                }, {"key": "A02B03C53D06", "vaule": "机车靴", "text": "A02B03C53"}, {
                    "key": "A02B03C51D02",
                    "vaule": "拖鞋",
                    "text": "A02B03C51"
                }, {"key": "A02B03C54D02", "vaule": "安全鞋", "text": "A02B03C54"}, {
                    "key": "A02B02C63D10",
                    "vaule": "短袖Polo衫",
                    "text": "A02B02C63"
                }, {"key": "A02B02C64D02", "vaule": "休闲裤", "text": "A02B02C64"}, {
                    "key": "A01B07C27D02",
                    "vaule": "男士香水",
                    "text": "A01B07C27"
                }, {"key": "A02B02C68D02", "vaule": "运动POLO", "text": "A02B02C68"}, {
                    "key": "A02B02C69D02",
                    "vaule": "领带",
                    "text": "A02B02C69"
                }, {"key": "A02B02C66D02", "vaule": "打底背心", "text": "A02B02C66"}, {
                    "key": "A02B02C65D03",
                    "vaule": "夹克",
                    "text": "A02B02C65"
                }, {"key": "A02B02C65D04", "vaule": "棉衣", "text": "A02B02C65"}, {
                    "key": "A02B02C66D03",
                    "vaule": "保暖内衣",
                    "text": "A02B02C66"
                }, {"key": "A02B02C68D03", "vaule": "运动无袖上衣", "text": "A02B02C68"}, {
                    "key": "A02B02C69D03",
                    "vaule": "腰带",
                    "text": "A02B02C69"
                }, {"key": "A01B07C27D03", "vaule": "香水套装", "text": "A01B07C27"}, {
                    "key": "A02B02C63D08",
                    "vaule": "短袖衬衫",
                    "text": "A02B02C63"
                }, {"key": "A02B02C64", "vaule": "裤装", "text": "A02B02"}, {
                    "key": "A02B02C64D03",
                    "vaule": "西裤",
                    "text": "A02B02C64"
                }, {"key": "A02B03C55", "vaule": "运动鞋", "text": "A02B03"}, {
                    "key": "A02B03C53D07",
                    "vaule": "马丁靴",
                    "text": "A02B03C53"
                }, {"key": "A01B05C38D03", "vaule": "家具", "text": "A01B05C38"}, {
                    "key": "A01B07C25D03",
                    "vaule": "精华",
                    "text": "A01B07C25"
                }, {"key": "A01B07C26D03", "vaule": "粉饼", "text": "A01B07C26"}, {
                    "key": "A01B07C27",
                    "vaule": "香氛",
                    "text": "A01B07"
                }, {"key": "A01B04C55D03", "vaule": "伞具", "text": "A01B04C55"}, {
                    "key": "A01B05C31D03",
                    "vaule": "被套/枕套",
                    "text": "A01B05C31"
                }, {"key": "A01B05C32D03", "vaule": "酒具", "text": "A01B05C32"}, {
                    "key": "A01B05C33",
                    "vaule": "艺术家饰",
                    "text": "A01B05"
                }, {"key": "A01B03C62D03", "vaule": "户外鞋", "text": "A01B03C62"}, {
                    "key": "A01B03C60D03",
                    "vaule": "及膝靴",
                    "text": "A01B03C60"
                }, {"key": "A01B03C62", "vaule": "休闲运动鞋", "text": "A01B03"}, {
                    "key": "A01B04C54D03",
                    "vaule": "智能手表",
                    "text": "A01B04C54"
                }, {"key": "A01B04C54", "vaule": "腕表", "text": "A01B04"}, {
                    "key": "A01B04C53D04",
                    "vaule": "儿童眼镜",
                    "text": "A01B04C53"
                }, {"key": "A01B04C52D03", "vaule": "耳饰", "text": "A01B04C52"}, {
                    "key": "A01B02C95D03",
                    "vaule": "手套",
                    "text": "A01B02C95"
                }, {"key": "A01B03C59D03", "vaule": "高跟鞋", "text": "A01B03C59"}, {
                    "key": "A01B03C58D03",
                    "vaule": "高跟凉鞋",
                    "text": "A01B03C58"
                }, {"key": "A01B02C94D03", "vaule": "运动裙子", "text": "A01B02C94"}, {
                    "key": "A01B02C93D03",
                    "vaule": "塑身衣",
                    "text": "A01B02C93"
                }, {"key": "A01B02C92D03", "vaule": "夹克", "text": "A01B02C92"}, {
                    "key": "A01B02C91",
                    "vaule": "裙装",
                    "text": "A01B02"
                }, {"key": "A01B02C90D03", "vaule": "正装裤", "text": "A01B02C90"}, {
                    "key": "A01B02C89D06",
                    "vaule": "卫衣",
                    "text": "A01B02C89"
                }, {"key": "A01B01C62D03", "vaule": "名片夹", "text": "A01B01C62"}, {
                    "key": "A01B01C62",
                    "vaule": "小型包具",
                    "text": "A01B01"
                }, {"key": "A01B01C63D03", "vaule": "功能箱包", "text": "A01B01C63"}, {
                    "key": "A01B01C61D03",
                    "vaule": "钱包",
                    "text": "A01B01C61"
                }, {"key": "A01B01C60D04", "vaule": "斜挎包", "text": "A01B01C60"}, {
                    "key": "A01B01C60D05",
                    "vaule": "双肩包",
                    "text": "A01B01C60"
                }, {"key": "A01B01C61D04", "vaule": "斜挎包", "text": "A01B01C61"}, {
                    "key": "A01B01C63D04",
                    "vaule": "手拎包",
                    "text": "A01B01C63"
                }, {"key": "A01B01C63", "vaule": "户外/运动", "text": "A01B01"}, {
                    "key": "A01B01C62D04",
                    "vaule": "卡包",
                    "text": "A01B01C62"
                }, {"key": "A01B02C89D04", "vaule": "背心/吊带", "text": "A01B02C89"}, {
                    "key": "A01B02C90D04",
                    "vaule": "短裤",
                    "text": "A01B02C90"
                }, {"key": "A01B02C92D04", "vaule": "棉衣", "text": "A01B02C92"}, {
                    "key": "A01B02C93D04",
                    "vaule": "保暖内衣",
                    "text": "A01B02C93"
                }, {"key": "A01B02C93", "vaule": "内衣", "text": "A01B02"}, {
                    "key": "A01B02C94D04",
                    "vaule": "泳装",
                    "text": "A01B02C94"
                }, {"key": "A01B03C58D04", "vaule": "坡跟凉鞋", "text": "A01B03C58"}, {
                    "key": "A01B03C58",
                    "vaule": "凉鞋",
                    "text": "A01B03"
                }, {"key": "A01B03C59D04", "vaule": "坡跟鞋", "text": "A01B03C59"}, {
                    "key": "A01B02C95D04",
                    "vaule": "围巾",
                    "text": "A01B02C95"
                }, {"key": "A01B04C52D04", "vaule": "发饰", "text": "A01B04C52"}, {
                    "key": "A01B03C60D04",
                    "vaule": "过膝靴",
                    "text": "A01B03C60"
                }, {"key": "A01B05C32D04", "vaule": "茶具", "text": "A01B05C32"}, {
                    "key": "A01B05C34",
                    "vaule": "居家用品",
                    "text": "A01B05"
                }, {"key": "A01B05C31D04", "vaule": "枕头/靠枕", "text": "A01B05C31"}, {
                    "key": "A01B04C55D04",
                    "vaule": "私人订制",
                    "text": "A01B04C55"
                }, {"key": "A01B04C54D04", "vaule": "儿童手表", "text": "A01B04C54"}, {
                    "key": "A01B04C55",
                    "vaule": "配件礼品",
                    "text": "A01B04"
                }, {"key": "A01B07C26D04", "vaule": "粉底", "text": "A01B07C26"}, {
                    "key": "A01B07C25D04",
                    "vaule": "乳液",
                    "text": "A01B07C25"
                }, {"key": "A02B03C53D08", "vaule": "军靴", "text": "A02B03C53"}, {
                    "key": "A02B03C55D07",
                    "vaule": "滑板鞋",
                    "text": "A02B03C55"
                }, {"key": "A01B07C27D04", "vaule": "中性香水", "text": "A01B07C27"}, {
                    "key": "A02B02C69D04",
                    "vaule": "手套",
                    "text": "A02B02C69"
                }, {"key": "A02B03C51", "vaule": "凉鞋", "text": "A02B03"}, {
                    "key": "A02B02C68D04",
                    "vaule": "运动卫衣",
                    "text": "A02B02C68"
                }, {"key": "A02B02C66", "vaule": "内衣", "text": "A02B02"}, {
                    "key": "A02B02C66D04",
                    "vaule": "家居服",
                    "text": "A02B02C66"
                }, {"key": "A02B02C65D01", "vaule": "西装", "text": "A02B02C65"}, {
                    "key": "A02B02C64D04",
                    "vaule": "短裤",
                    "text": "A02B02C64"
                }, {"key": "A02B02C65D06", "vaule": "皮衣", "text": "A02B02C65"}, {
                    "key": "A02B02C66D05",
                    "vaule": "袜子",
                    "text": "A02B02C66"
                }, {"key": "A02B02C67", "vaule": "套装", "text": "A02B02"}, {
                    "key": "A02B02C68D05",
                    "vaule": "运动外套",
                    "text": "A02B02C68"
                }, {"key": "A02B02C69D05", "vaule": "围巾", "text": "A02B02C69"}, {
                    "key": "A02B02C63D05",
                    "vaule": "马甲/背心",
                    "text": "A02B02C63"
                }, {"key": "A02B03C55D08", "vaule": "运动鞋", "text": "A02B03C55"}, {
                    "key": "A02B03C54",
                    "vaule": "特殊功能鞋",
                    "text": "A02B03"
                }, {"key": "A02B03C53D03", "vaule": "雪地靴", "text": "A02B03C53"}, {
                    "key": "A01B07C25D05",
                    "vaule": "面霜",
                    "text": "A01B07C25"
                }, {"key": "A01B07C26D05", "vaule": "眼影", "text": "A01B07C26"}, {
                    "key": "A01B04C54D05",
                    "vaule": "座钟配件",
                    "text": "A01B04C54"
                }, {"key": "A01B05C31D05", "vaule": "毯子/床盖", "text": "A01B05C31"}, {
                    "key": "A01B05C35",
                    "vaule": "厨房用具",
                    "text": "A01B05"
                }, {"key": "A01B03C60D05", "vaule": "雪地靴", "text": "A01B03C60"}, {
                    "key": "A01B03C61",
                    "vaule": "家居鞋",
                    "text": "A01B03"
                }, {"key": "A01B04C52D05", "vaule": "胸针", "text": "A01B04C52"}, {
                    "key": "A01B03C59D05",
                    "vaule": "豆豆鞋",
                    "text": "A01B03C59"
                }, {"key": "A01B02C94D05", "vaule": "运动短裤", "text": "A01B02C94"}, {
                    "key": "A01B02C93D05",
                    "vaule": "家居服/睡衣",
                    "text": "A01B02C93"
                }, {"key": "A01B02C92D05", "vaule": "大衣", "text": "A01B02C92"}, {
                    "key": "A01B02C90D05",
                    "vaule": "打底裤",
                    "text": "A01B02C90"
                }, {"key": "A01B02C90", "vaule": "裤装", "text": "A01B02"}, {
                    "key": "A01B01C64",
                    "vaule": "旅行箱包",
                    "text": "A01B01"
                }, {"key": "A01B01C63D05", "vaule": "运动腰包", "text": "A01B01C63"}, {
                    "key": "A01B01C61D05",
                    "vaule": "手拿包",
                    "text": "A01B01C61"
                }, {"key": "A01B01C60D06", "vaule": "手拿包", "text": "A01B01C60"}, {
                    "key": "A01B01C60D18",
                    "vaule": "信封包",
                    "text": "A01B01C60"
                }, {"key": "A01B01C61D06", "vaule": "双肩包", "text": "A01B01C61"}, {
                    "key": "A01B01C63D06",
                    "vaule": "GOLF包",
                    "text": "A01B01C63"
                }, {"key": "A01B02C89D07", "vaule": "针织衫/毛衣", "text": "A01B02C89"}, {
                    "key": "A01B02C90D06",
                    "vaule": "连体裤",
                    "text": "A01B02C90"
                }, {"key": "A01B02C92D06", "vaule": "皮衣", "text": "A01B02C92"}, {
                    "key": "A01B02C93D06",
                    "vaule": "袜子",
                    "text": "A01B02C93"
                }, {"key": "A01B03C59D06", "vaule": "牛津鞋", "text": "A01B03C59"}, {
                    "key": "A01B03C58D05",
                    "vaule": "拖鞋",
                    "text": "A01B03C58"
                }, {"key": "A01B02C95", "vaule": "服饰配饰", "text": "A01B02"}, {
                    "key": "A01B02C94D06",
                    "vaule": "套装",
                    "text": "A01B02C94"
                }, {"key": "A01B04C52D06", "vaule": "戒指", "text": "A01B04C52"}, {
                    "key": "A01B03C60D06",
                    "vaule": "雨靴",
                    "text": "A01B03C60"
                }, {"key": "A01B05C36", "vaule": "精品家电", "text": "A01B05"}, {
                    "key": "A01B05C31D06",
                    "vaule": "凉席/蚊帐",
                    "text": "A01B05C31"
                }, {"key": "A01B07C26D06", "vaule": "眼线", "text": "A01B07C26"}, {
                    "key": "A01B07C25D06",
                    "vaule": "眼霜",
                    "text": "A01B07C25"
                }, {"key": "A02B03C53D04", "vaule": "雨靴", "text": "A02B03C53"}, {
                    "key": "A02B03C55D02",
                    "vaule": "跑步鞋",
                    "text": "A02B03C55"
                }, {"key": "A02B02C68", "vaule": "休闲运动", "text": "A02B02"}, {
                    "key": "A02B02C66D06",
                    "vaule": "套装",
                    "text": "A02B02C66"
                }, {"key": "A02B02C65D05", "vaule": "毛呢大衣", "text": "A02B02C65"}, {
                    "key": "A02B02C65D07",
                    "vaule": "羽绒服",
                    "text": "A02B02C65"
                }, {"key": "A02B02C69", "vaule": "服饰配饰", "text": "A02B02"}, {
                    "key": "A02B03C55D03",
                    "vaule": "户外鞋",
                    "text": "A02B03C55"
                }, {"key": "A01B07C25D07", "vaule": "面膜", "text": "A01B07C25"}, {
                    "key": "A01B07C26D07",
                    "vaule": "睫毛膏",
                    "text": "A01B07C26"
                }, {"key": "A01B05C37", "vaule": "毛巾卫浴", "text": "A01B05"}, {
                    "key": "A01B04C52D07",
                    "vaule": "饰品配件",
                    "text": "A01B04C52"
                }, {"key": "A01B03C58D07", "vaule": "鱼嘴鞋", "text": "A01B03C58"}, {
                    "key": "A01B03C59D07",
                    "vaule": "乐福鞋",
                    "text": "A01B03C59"
                }, {"key": "A01B02C93D07", "vaule": "内衣配件", "text": "A01B02C93"}, {
                    "key": "A01B02C94",
                    "vaule": "运动/户外",
                    "text": "A01B02"
                }, {"key": "A01B02C92D07", "vaule": "皮草", "text": "A01B02C92"}, {
                    "key": "A01B02C89D03",
                    "vaule": "上衣",
                    "text": "A01B02C89"
                }, {"key": "A01B01C61D07", "vaule": "单肩包", "text": "A01B01C61"}, {
                    "key": "A01B01C60D07",
                    "vaule": "化妆包",
                    "text": "A01B01C60"
                }, {"key": "A01B01C61D08", "vaule": "盥洗包", "text": "A01B01C61"}, {
                    "key": "A01B02C89D08",
                    "vaule": "马甲",
                    "text": "A01B02C89"
                }, {"key": "A01B02C93D08", "vaule": "套装", "text": "A01B02C93"}, {
                    "key": "A01B02C92D08",
                    "vaule": "羽绒服",
                    "text": "A01B02C92"
                }, {"key": "A01B03C59D08", "vaule": "系带鞋", "text": "A01B03C59"}, {
                    "key": "A01B07C26D08",
                    "vaule": "唇彩",
                    "text": "A01B07C26"
                }, {"key": "A01B07C25D08", "vaule": "护肤套装", "text": "A01B07C25"}, {
                    "key": "A01B05C38",
                    "vaule": "家纺布艺",
                    "text": "A01B05"
                }, {"key": "A02B03C55D05", "vaule": "训练鞋", "text": "A02B03C55"}, {
                    "key": "A02B03C55D09",
                    "vaule": "徒步鞋",
                    "text": "A02B03C55"
                }, {"key": "A01B07C26D09", "vaule": "腮红", "text": "A01B07C26"}, {
                    "key": "A01B07C25D09",
                    "vaule": "身体护理",
                    "text": "A01B07C25"
                }, {"key": "A01B01C60D14", "vaule": "小方包", "text": "A01B01C60"}, {
                    "key": "A01B01C60D19",
                    "vaule": "凯莉包",
                    "text": "A01B01C60"
                }, {"key": "A01B07C26D10", "vaule": "彩妆套装", "text": "A01B07C26"}, {
                    "key": "A02B03C55D10",
                    "vaule": "登山鞋",
                    "text": "A02B03C55"
                }, {"key": "A02B03C55D11", "vaule": "溯溪鞋", "text": "A02B03C55"}, {
                    "key": "A01B07C26D11",
                    "vaule": "指甲油",
                    "text": "A01B07C26"
                }, {"key": "A01B07C26D12", "vaule": "化妆工具", "text": "A01B07C26"}, {
                    "key": "A02B03C55D12",
                    "vaule": "沙滩鞋",
                    "text": "A02B03C55"
                }, {"key": "A01B01C60D21", "vaule": "医生包", "text": "A01B01C60"}, {
                    "key": "A01B01C60D22",
                    "vaule": "小猪包",
                    "text": "A01B01C60"
                }, {"key": "A02B03C55D13", "vaule": "GOLF场地鞋", "text": "A02B03C55"}, {
                    "key": "A01B07C26D13",
                    "vaule": "美甲",
                    "text": "A01B07C26"
                }, {"key": "A01B07C26D14", "vaule": "美容工具", "text": "A01B07C26"}]
            }
            this.setState({
                commoditytreeData: tools.deepCopy((tools.listToTree('key', 'text', res.result)))
            })
        })
    }
    getAllERPType = () => {
        return Fetch.getAllERPType().then((res) => {
            console.log(res)
            this.setState({
                ERPtreeData: tools.deepCopy((tools.listToTree('key', 'text', res.result)))
            })
        })
    }
    getAllBrand = () => {
        return Fetch.getAllBrand().then((res) => {
            this.brandList = res.result || [];
        })
    }
    getVirtualArea = () => {
        return Fetch.getVirtualArea().then((res) => {
            if (res && res.code === '200') {
                this.setState({
                    virtualList: res.result.map(item => {
                        return {
                            value: item.key,
                            label: item.vaule
                        }
                    })
                })
            }

        })
    }
    getAllColor = () => {
        return Fetch.getAllColor().then((res) => {
            this.setState({
                colorList: res.result && res.result.map((item) => {
                    return {
                        value: item.key,
                        name: item.vaule + (item.text ? `\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0${item.text}` : ``)
                    }
                })
            })
        })
    }
    getTotal = () => {
        this.props.form.validateFields(['select_brand'], (err) => {
            if (!err) {
                const {name} = this.props.data;
                // const {excelFile}=this.state;
                const {id, pid} = this.props.location.query;
                const {
                    range,
                    commodityType,
                    select_brand,
                    minPrice,
                    maxPrice,
                    selectColor,
                    virtualDistrict,
                    otherProps,
                    excelFile,
                    selectType,
                    ERPType,
                } = this.props.form.getFieldsValue();

                Fetch.getRangeTotal({
                    "presaleId": id,
                    "rangeModel": {
                        "id": pid,
                        "name": name,
                        "state": pid ? 1 : 0,
                        "categorySelectType": selectType,
                        // "dataType": ,
                        "rangeType": Number(range),
                        "condition": excelFile,
                        "categoryNo": commodityType && commodityType.join(','),
                        "ErpCategoryNo": ERPType && ERPType.join(','),
                        "brandNo": select_brand && select_brand.join(','),
                        "virtualAreaNo": virtualDistrict && virtualDistrict.join(','),
                        "priceMax": Number(maxPrice) === 0 ? undefined : Number(maxPrice),
                        "priceMin": Number(minPrice) === 0 ? undefined : Number(minPrice),
                        "colorNo": selectColor && selectColor.join(','),
                        "fromType": 1,
                        "newSeason": otherProps===0?0:(otherProps||-1)
                    }
                }).then(res => {
                    if (res.code && res.code === '200') {
                        message.success('请求数量成功了！');
                        this.setState({
                            rangeCount: res.result && res.result.count
                        })
                    }

                })
            }
        })
    }
    commit = () => {
        const {validateFields, getFieldsError, getFieldsValue,getFieldValue} = this.props.form;
        validateFields([getFieldValue('range')===0?'select_brand':'excelFile'], (err) => {
            if (!err) {
                const {name} = this.props.data;
                // const {excelFile}=this.state;
                const {id, pid} = this.props.location.query;
                const {
                    range,
                    commodityType,
                    select_brand,
                    minPrice,
                    maxPrice,
                    selectColor,
                    virtualDistrict,
                    otherProps,
                    excelFile,
                    selectType,
                    ERPType,
                } = getFieldsValue();

                console.log(Number(range))
                console.log(range)
                Fetch.setRangeCondition({
                    "presaleId": id,
                    "rangeModel": {
                        "id": pid,
                        "name": name,
                        "state": pid ? 1 : 0,
                        "categorySelectType": selectType,
                        // "dataType": ,
                        "rangeType": Number(range),
                        "condition": excelFile,
                        "categoryNo": commodityType && commodityType.join(','),
                        "ErpCategoryNo": ERPType && ERPType.join(','),
                        "brandNo": select_brand && select_brand.join(','),
                        "virtualAreaNo": virtualDistrict && virtualDistrict.join(','),
                        "priceMax": Number(maxPrice) === 0 ? undefined : Number(maxPrice),
                        "priceMin": Number(minPrice) === 0 ? undefined : Number(minPrice),
                        "colorNo": selectColor && selectColor.join(','),
                        "fromType": 1,
                        "newSeason": otherProps===0?0:(otherProps||-1)
                    }
                }).then(res => {
                    if (res.code && res.code === '200') {
                        this.props.router.replace({
                            pathname: '/app/home/add',
                            query: {
                                pid: res.result && res.result.key || pid,
                                id: id
                            }
                        });
                        this.props.toView(2)
                    }

                })
            }
        })

    }
    selectTypeChange = (obj) => {
        if (obj.target.value === 0) {
            this.setState({
                isCommodityType: false,
                isERPType: true
            })
        } else {
            this.setState({
                isCommodityType: true,
                isERPType: false
            })
        }
    }

    render() {

        const {getFieldDecorator, getFieldsError, getFieldValue, getFieldError, isFieldTouched, isFieldsTouched, validateFields} = this.props.form;
        const {previewVisible, isERPType, isCommodityType, rangeCount, brandList, colorList, virtualList, previewImage, promotionIcon, presellBackground, tProps} = this.state;

        const commodityType = {
            value: this.state.commodityValue,
            treeData: this.state.commoditytreeData,
            showSearch: true,
            onChange: this.onChange,
            treeCheckable: true,
            showCheckedStrategy: SHOW_PARENT,
            searchPlaceholder: '请选择商城分类',
            treeNodeFilterProp: 'title',
            style: {
                width: 300,
            }
        }
        const ERPType = {
            treeData: this.state.ERPtreeData,
            showSearch: true,
            onChange: this.onChange,
            treeCheckable: true,
            showCheckedStrategy: SHOW_PARENT,
            searchPlaceholder: '请选择ERP品类',
            treeNodeFilterProp: 'title',
            style: {
                width: 300,
            }
        }
        const props = {
            name: 'file',
            action: '/upload/picture/uploadERP',
            headers: {
                authorization: 'authorization-text',
            },
            onChange: ({fileList}) => {
                const info = fileList;
                const response = info[0] && info[0].response;
                if (response && response.error === 0) {
                    message.success('上传成功了');
                }
            },
        };
        const itemLayout = {
            labelCol: {
                span: 6
            },
            wrapperCol: {
                span: 18
            }
        }
        const minPriceLayout = {
            labelCol: {
                span: 10
            },
            wrapperCol: {
                span: 14
            }
        }
        const maxPriceLayout = {
            labelCol: {
                span: 0
            },
            wrapperCol: {
                span: 24
            }
        }
        const excelLayout = {
            colon: false,
            labelCol: {
                span: 6
            },
            wrapperCol: {
                span: 18
            }
        }


        function hasErrors(fieldsError) {
            return Object.keys(fieldsError).some(field => fieldsError[field]);
        }

        function normalize(obj) {
            console.log(obj)
            if (typeof obj === 'string') {
                return obj;
            }
            if (typeof obj === 'object') {
                console.log(obj)
                const {fileList} = obj;
                return (fileList && fileList[0] && fileList[0].response && fileList[0].response.url);
            }
        };

        return (
            <div className={'step2'}>
                <Form>
                    <Form.Item
                        label={'预售编号：'}
                        {...itemLayout}
                    >
                        {this.props.location.query.id}
                    </Form.Item>
                    <Form.Item
                        label={'商品范围：'}
                        {...itemLayout}
                    >
                        {getFieldDecorator('range', {
                            initialValue: 0
                        })(
                            <RadioGroup>
                                <Radio value={0}>按规则</Radio>
                                <Radio value={1}>按商品</Radio>
                            </RadioGroup>
                        )}
                    </Form.Item>
                    {
                        getFieldValue('range') === 0 &&
                        <div>
                            <Form.Item
                                label={'分类：'}
                                {...itemLayout}
                                className={'marginBottom0'}
                            >
                                {getFieldDecorator('selectType', {
                                    initialValue: 1
                                })(
                                    <RadioGroup name="radiogroup" onChange={this.selectTypeChange}>
                                        <Radio value={0}>选择ERP品类</Radio>
                                        <Radio value={1}>选择商城分类</Radio>
                                    </RadioGroup>
                                )}
                            </Form.Item>
                            {
                                isCommodityType === true &&
                                <Form.Item
                                    {...itemLayout}
                                    label={'请选择商城分类：'}
                                    className={'marginBottm20'}
                                >
                                    {getFieldDecorator('commodityType', {
                                        initialValue: [],
                                        rules: [
                                            {
                                                validator: (rule, value, callback) => {
                                                    const {commodityType, ERPType, select_brand, virtualDistrict} = this.props.form.getFieldsValue();
                                                    if ((commodityType && commodityType.length) ||
                                                        (ERPType && ERPType.length) ||
                                                        (select_brand && select_brand.length) ||
                                                        (virtualDistrict && virtualDistrict.length)) {
                                                        callback();
                                                        validateFields(['ERPType', 'select_brand', 'virtualDistrict'], function () {

                                                        });

                                                    } else {
                                                        callback('ERP分类、商城分类、品牌、虚拟区域至少选择一项')
                                                        validateFields(['ERPType', 'select_brand', 'virtualDistrict'], function () {

                                                        });
                                                    }

                                                }
                                            }
                                        ]
                                    })(
                                        <TreeSelect {...commodityType} />
                                    )}
                                </Form.Item>}

                            {
                                isERPType === true &&
                                <Form.Item
                                    {...itemLayout}
                                    label={'请选择ERP品类：'}
                                    className={'marginBottm20'}
                                >
                                    {getFieldDecorator('ERPType', {
                                        initialValue: [],
                                        rules: [
                                            {
                                                validator: (rule, value, callback) => {
                                                    const {commodityType, ERPType, select_brand, virtualDistrict} = this.props.form.getFieldsValue();
                                                    if ((commodityType && commodityType.length) ||
                                                        (ERPType && ERPType.length) ||
                                                        (select_brand && select_brand.length) ||
                                                        (virtualDistrict && virtualDistrict.length)) {
                                                        callback();
                                                        validateFields(['commodityType','select_brand', 'virtualDistrict'], function () {

                                                        });

                                                    } else {
                                                        callback('ERP分类、商城分类、品牌、虚拟区域至少选择一项')
                                                        validateFields(['commodityType','select_brand', 'virtualDistrict'], function () {

                                                        });
                                                    }

                                                }
                                            }
                                        ]
                                    })(
                                        <TreeSelect  {...ERPType} />
                                    )}
                                </Form.Item>
                            }

                            <Form.Item
                                label={'品牌：'}
                                {...itemLayout}
                                className={'margintTop30'}
                            >
                                {getFieldDecorator('select_brand', {
                                    initialValue: [],
                                    rules: [
                                        {
                                            validator: (rule, value, callback) => {
                                                const {commodityType, ERPType, select_brand, virtualDistrict} = this.props.form.getFieldsValue();
                                                if ((commodityType && commodityType.length) ||
                                                    (ERPType && ERPType.length) ||
                                                    (select_brand && select_brand.length) ||
                                                    (virtualDistrict && virtualDistrict.length)) {
                                                    callback();
                                                    validateFields(['commodityType', 'ERPType','virtualDistrict'], function () {

                                                    });

                                                } else {
                                                    callback('ERP分类、商城分类、品牌、虚拟区域至少选择一项')
                                                    validateFields(['commodityType', 'ERPType','virtualDistrict'], function () {

                                                    });
                                                }

                                            }
                                        }
                                    ]
                                })(
                                    <Select
                                        mode="multiple"
                                        style={{width: '100%'}}
                                        onSearch={this.brandSearch}
                                        placeholder={'搜索可使用>A会显示以A开头的品牌，模糊搜索不能小于3个字母'}
                                        optionFilterProp={'children'}
                                        tokenSeparators={[',']}
                                        filterOption={false}
                                    >
                                        {brandList.map((item) => {
                                            return <Option key={item.value}>{item.name}</Option>
                                        })}
                                    </Select>
                                )}
                            </Form.Item>
                            <Form.Item
                                label={'虚拟区域：'}
                                {...itemLayout}
                            >
                                {getFieldDecorator('virtualDistrict', {
                                    initialValue: [],
                                    rules: [
                                        {
                                            validator: (rule, value, callback) => {
                                                const {commodityType, ERPType, select_brand, virtualDistrict} = this.props.form.getFieldsValue();
                                                if ((commodityType && commodityType.length) ||
                                                    (ERPType && ERPType.length) ||
                                                    (select_brand && select_brand.length) ||
                                                    (virtualDistrict && virtualDistrict.length)) {
                                                    callback();
                                                    validateFields(['commodityType', 'ERPType', 'select_brand'], function () {

                                                    });

                                                } else {
                                                    callback('ERP分类、商城分类、品牌、虚拟区域至少选择一项')
                                                    validateFields(['commodityType', 'ERPType', 'select_brand'], function () {

                                                    });
                                                }

                                            }
                                        }
                                    ]
                                })(
                                    <CheckboxGroup options={virtualList} onChange={this.onChange}/>
                                )}
                            </Form.Item>
                            <div className={'priceRange_wrap'}>
                                <div>
                                    <Form.Item
                                        label={'价格区间：'}
                                        {...minPriceLayout}
                                    >
                                        {getFieldDecorator('minPrice', {
                                            rules: [
                                                {pattern: /^[\d]+$/, message: '请填写数字!'}
                                            ],
                                        })(
                                            <Input placeholder="请输入最小金额"/>
                                        )}
                                    </Form.Item>
                                </div>
                                <i></i>
                                <h5>
                                    <Form.Item
                                        {...maxPriceLayout}
                                    >
                                        {getFieldDecorator('maxPrice', {
                                            rules: [
                                                {pattern: /^[\d]+$/, message: '请填写数字!'}
                                            ],
                                        })(
                                            <Input placeholder="请输入最大价格"/>
                                        )}
                                    </Form.Item>
                                </h5>
                            </div>


                            <Form.Item
                                label={'颜色选择：'}
                                {...itemLayout}
                            >
                                {getFieldDecorator('selectColor', {
                                    rules: [],
                                })(
                                    <Select
                                        mode="multiple"
                                        showSearch
                                        placeholder="请选择颜色"
                                        filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                                    >
                                        {colorList && colorList.map((item) => {
                                            return <Option key={item.value}>{item.name}</Option>
                                        })}
                                    </Select>
                                )}
                            </Form.Item>

                            <Form.Item
                                label={'其他属性：'}
                                {...itemLayout}
                            >
                                {getFieldDecorator('otherProps', {
                                    rules: [
                                        // {required: true, message: '请至少选择一项！'},
                                    ],
                                })(
                                    <RadioGroup name="radiogroup" onChange={this.onChange}>
                                        {oterProps.map((item) => {
                                            return <Radio value={item.value}>{item.label}</Radio>
                                        })}
                                    </RadioGroup>
                                )}
                            </Form.Item>
                            <Form.Item
                                label={'预览总数量：'}
                                {...itemLayout}
                            >
                                {rangeCount}
                                <Button disabled={hasErrors(getFieldsError())} onClick={this.getTotal}
                                        style={{marginLeft: 30}}>请求总数量</Button>
                            </Form.Item>
                        </div>
                    }
                    {
                        getFieldValue('range') === 1 &&
                        <div>
                            <Form.Item
                                label={'商品编号：'}
                                {...itemLayout}
                                className={'marginBottom0'}
                            >
                                {getFieldDecorator('excelFile', {
                                    initialValue:'',
                                    rules: [
                                        {required: true, message: '请上传Excel!'},
                                    ],
                                    normalize: normalize,

                                })(
                                    <Upload   {...props}>
                                        <Button>
                                            浏览
                                        </Button>
                                    </Upload>
                                )}
                            </Form.Item>
                            <Form.Item
                                label={' '}
                                {...excelLayout}
                            >
                                请上传设置的商品编号excel文件
                            </Form.Item>
                            <Form.Item
                                label={' '}
                                {...excelLayout}
                            >
                                <a onClick={this.downLoad}>下载模板</a>
                            </Form.Item>

                        </div>
                    }


                </Form>
                <div className={'step2_submit_wrap'}>
                    <Button disabled={hasErrors(getFieldsError())} style={{marginRight: 30}} type={'primary'}
                            onClick={this.commit}>提交</Button>
                    <Button disabled={hasErrors(getFieldsError())} style={{marginRight: 30}} type={'primary'}
                            onClick={this.next}>跳过</Button>
                    <Button onClick={this.reset}>重置</Button>
                </div>
            </div>


        )
    }

}

export default Form.create()(Step2);